﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demo.aspx.cs" Inherits="eDream.demo" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <script type="text/javascript">
            // <![CDATA[
            function Uploader_OnUploadStart() {
                btnUpload.SetEnabled(false);
            }

            function Uploader_OnFileUploadComplete(args) {
                var imgSrc = aspxPreviewImgSrc;
                if (args.isValid) {
                    var date = new Date();
                    imgSrc = '<%=pathUrl %>' + args.callbackData;
                    //alert(imgSrc);
                }
                getPreviewImageElement().src = imgSrc;
            }
            function Uploader_OnFilesUploadComplete(args) {
                UpdateUploadButton();
            }
            function UpdateUploadButton() {
                btnUpload.SetEnabled(uploader.GetText(0) != "");
            }
            function getPreviewImageElement() {
                return document.getElementById("previewImage");
            }
            // ]]> 
        </script>
        <div>
            <table>
                <tr>
                    <td>
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" Text="Upload basic" OnClick="Button1_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <dx:ASPxUploadControl ID="ASPxUploadControl1" runat="server" Width="280px"></dx:ASPxUploadControl>
                    </td>
                    <td>
                        <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Upload Low" OnClick="ASPxButton1_Click"></dx:ASPxButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <dx:ASPxUploadControl ID="uplImage" runat="server" ClientInstanceName="uploader" ShowProgressPanel="True"
                            NullText="Click here to browse files..." Size="35" OnFileUploadComplete="uplImage_FileUploadComplete">
                            <ClientSideEvents FileUploadComplete="function(s, e) { Uploader_OnFileUploadComplete(e); }"
                                FilesUploadComplete="function(s, e) { Uploader_OnFilesUploadComplete(e); }"
                                FileUploadStart="function(s, e) { Uploader_OnUploadStart(); }"
                                TextChanged="function(s, e) { UpdateUploadButton(); }"></ClientSideEvents>
                            <ValidationSettings MaxFileSize="4194304" AllowedFileExtensions=".jpg,.jpeg,.jpe,.gif">
                            </ValidationSettings>
                        </dx:ASPxUploadControl>
                        <br />
                        <dx:ASPxLabel ID="lblAllowebMimeType" runat="server" Text="Allowed image types: jpeg, gif"
                            Font-Size="8pt">
                        </dx:ASPxLabel>
                        <br />
                        <dx:ASPxLabel ID="lblMaxFileSize" runat="server" Text="Maximum file size: 4Mb" Font-Size="8pt">
                        </dx:ASPxLabel>
                    </td>
                    <td>
                        <dx:ASPxButton ID="btnUpload" runat="server" AutoPostBack="False" Text="Upload" ClientInstanceName="btnUpload"
                            Width="100px" ClientEnabled="False">
                            <ClientSideEvents Click="function(s, e) { uploader.Upload(); }" />
                        </dx:ASPxButton>
                    </td>
                </tr>
                <tr>
                    <td>
                        <img src="../Image/icon/26_mail.png" id="previewImage" alt="" />
                    </td>
                </tr>
            </table>


        </div>
        <script type="text/javascript">
            // <![CDATA[
            var aspxPreviewImgSrc = getPreviewImageElement().src;
           
            // ]]> 
</script>

        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <div>

        <asp:Label ID="lblImageFile" Text="Image File:" AssociatedControlID="upImage" runat="server" />

        <asp:FileUpload ID="upImage" runat="server" />

        <br />

        <br />

       
        

         <asp:Button ID="Button2" Text="Add Image to TaiLieu/" runat="server"

            onclick="btnAdd1_Click" />

        <hr />

        <asp:DataList ID="dlstImages" RepeatColumns="3" runat="server">

            <ItemTemplate>

                <asp:Image ID="Image1" ImageUrl='<%# Eval("Name", "~/TaiLieu/{0}") %>' Style="width: 200px"

                    runat="server" />

                <br />

                <%# Eval("Name") %>

            </ItemTemplate>

        </asp:DataList>

        <br />
             <asp:Button ID="btnAdd" Text="Add Image to TaiLieu/Msmart/" runat="server"

            onclick="btnAdd_Click" />
        <asp:DataList ID="DataList1" RepeatColumns="3" runat="server">

            <ItemTemplate>

                <asp:Image ID="Image1" ImageUrl='<%# Eval("Name", "~/TaiLieu/Msmart/{0}") %>' Style="width: 200px"

                    runat="server" />

                <br />

                <%# Eval("Name") %>

            </ItemTemplate>

        </asp:DataList>
         <br />
         <asp:Button ID="Button3" Text="Add Image to TaiLieu/Thum/" runat="server"

            onclick="Button3_Click" />
        <asp:DataList ID="DataList2" RepeatColumns="3" runat="server">

            <ItemTemplate>

                <asp:Image ID="Image1" ImageUrl='<%# Eval("Name", "~/TaiLieu/Thum/{0}") %>' Style="width: 200px"

                    runat="server" />

                <br />

                <%# Eval("Name") %>

            </ItemTemplate>

        </asp:DataList>

    </div>
    </form>
</body>
</html>
